package gov.nhso.prov.acc.core;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
 
import com.isud.core.ISUD;
import com.isud.core.ISUDFactory;

public class GenBean {
	public static void main(String[] args) {
		Connection conn = null;
		try {
			String schemaName = "";
			String[] arrTableName = new String[]{"ACC67_TRANSFER_DAILY"};

			String[] arrType = new String[]{"VARCHAR2","CHAR"};
			String pathBean = "D:\\workspaces\\provacc\\src\\gov\\nhso\\prov\\acc\\beans";
//			Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//			conn = DriverManager.getConnection("jdbc:sqlserver://192.168.2.141:1433;databaseName=DFS","sa","p@ssw0rd");
			
			//conn = DBConnection.getConnection();

			Class.forName("oracle.jdbc.driver.OracleDriver");
			//conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.201.10:1549:DEVDB", "PROVACC_OWNER", "3&9CB2&060");
			conn = DriverManager.getConnection("jdbc:oracle:thin:@192.168.2.232:1521:NHSO", "nhso_test", "oracle2");
			conn.setAutoCommit(false);
			ISUD isud = ISUDFactory.create(conn);
			for (int i = 0; i < arrTableName.length; i++) {
				isud.generateBean(schemaName, arrTableName[i], arrType, pathBean);
			}
			conn.commit();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				conn.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}
}
